@extends('shared.master')

@section('content')
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <ol class="breadcrumb layout-title">
                                    <li><a href="{{url('project')}}"><i class="fa fa-suitcase fa-fw"></i> Project</a></li>
                                    <li class="active" > Detail</li>
            </ol>
            {{PageData::Error()}}
            <div class="form-group">
                <label>Name</label>
                <p class="form-control-static">{{$Model->getName()}}</p>
            </div>
            <div class="form-group">
                <label>Description</label>
                <p class="form-control-static">{{$Model->getDescription()}}</p>
            </div>
            <div class="form-group">
                <label>Start Date</label>
                <p class="form-control-static">{{date("d-m-Y",strtotime($Model->getStartDate()))}}</p>
            </div>
            <div class="form-group">
                <label>Due Date</label>
                <p class="form-control-static">{{date("d-m-Y",strtotime($Model->getDueDate()))}}</p>
            </div>
            <div class="form-group">
                <label>Created By</label>
                <p class="form-control-static">{{$Model->getCreatedBy()!=null ? $Model->getCreatedBy()->getName() : ""}}</p>
            </div>
            <div class="form-group">
                <label>Created Date</label>
                <p class="form-control-static">{{$Model->getCreatedDate()}}</p>
            </div>
            <p>
            <br>
            <div class='row'>
            <div class="col-lg-6">
            <div class="panel panel-default">
                <div class="panel-heading">
                  <h3 class="panel-title">Project Employee Assignment</h3>
                </div>
            @if ($Model->getProjectAssignment() != null)
                <table class="table table-striped table-bordered table-hover" id="tbl_data_user" >
                    <thead>
                        <tr>
                            <th>Employee Name</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($Model->getProjectAssignment() as $item)
                            <tr class="odd gradeX" onclick="">
                            <td>{{$item->getUser()!=null ? $item->getUser()->getName() : "-"}}</td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            @else
                <div class="panel-body">
                    No Detail Found!
                </div>
            @endif
            </div>
            </div>
            </div>
            </br>
            <br>
            <div class="panel panel-default">
                <div class="panel-heading">
                  <h3 class="panel-title">Project Task</h3>
                </div>
            @if ($Model->getTasks() != null)
                <table class="table table-striped table-bordered table-hover" id="tbl_data_user">
                    <thead>
                        <tr>
                            <th>Nama</th>
                            <th>Start Date</th>
                            <th>Due Date</th>
                            <th>Priority</th>
                            <th>Status</th>
                            <th>Notes</th>
                            <th>Created Date</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($Model->getTasks() as $item)
                        <tr class="odd gradeX" onclick="">
                            <td>{{$item->getName() }}</td>
                            <td>{{$item->getStartDate() }}</td>
                            <td>{{$item->getDueDate() }}</td>
                            <td>{{$item->getPriority()!=null ? $item->getPriority()->getName() : "-" }}</td>
                            <td>{{$item->getStatus()!=null ? $item->getStatus()->getName() : "-" }}</td>
                            <td>{{$item->getNotes() }}</td>
                            <td>{{$item->getCreatedDate() }}</td> 
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            @else
                <div class="panel-body">
                    No Detail Found!
                </div>
            @endif
            </div>
            </br>
                @if ($userInformation->getGroup()->getId()=='leader')
                <button onClick="location.href='{{ action('ProjectController@edit', $Model->getId()) }}'" type="button" class="btn btn-primary">Edit</button>
                @endif
                <button onClick="location.href='{{url('project')}}'" type="button" class="btn btn-primary">Close</button>
            </p>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
</div>
<!-- /.container-fluid -->
    <script>
    
    </script>
@stop